
using Qdb.Foundation;

namespace Qdb.Foundation
{
	/// <exclude></exclude>
	public class HashtableIntEntry : IEntry4, IDeepClone
	{
		public int _key;

		public object _object;

		public Qdb.Foundation.HashtableIntEntry _next;

		internal HashtableIntEntry(int a_hash, object a_object)
		{
			// FIELDS ARE PUBLIC SO THEY CAN BE REFLECTED ON IN JDKs <= 1.1
			_key = a_hash;
			_object = a_object;
		}

		public HashtableIntEntry()
		{
		}

		public virtual object Key()
		{
			return _key;
		}

		public virtual object Value()
		{
			return _object;
		}

		public virtual object DeepClone(object obj)
		{
			return DeepCloneInternal(new Qdb.Foundation.HashtableIntEntry(), obj);
		}

		public virtual bool SameKeyAs(Qdb.Foundation.HashtableIntEntry other)
		{
			return _key == other._key;
		}

		protected virtual Qdb.Foundation.HashtableIntEntry DeepCloneInternal(
			Qdb.Foundation.HashtableIntEntry entry, object obj)
		{
			entry._key = _key;
			entry._next = _next;
			if (_object is IDeepClone)
			{
				entry._object = ((IDeepClone)_object).DeepClone(obj);
			}
			else
			{
				entry._object = _object;
			}
			if (_next != null)
			{
				entry._next = (Qdb.Foundation.HashtableIntEntry)_next.DeepClone(obj);
			}
			return entry;
		}

		public override string ToString()
		{
			return string.Empty + _key + ": " + _object;
		}
	}
}
